{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%R\n",
    "motifRankings <- load('dm6_UPSTREAM5KB_FULL_TX_motifRanking.RData')\n",
    "write.csv(as.data.frame(motifRankings@rankings), file=\"dm6.tmp.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from pyarrow.feather import write_feather"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"dm6.tmp.csv\", index_col=1)\n",
    "del df['Unnamed: 0']\n",
    "df = df.T\n",
    "df.index.name = 'features'\n",
    "df.reset_index(inplace=True)\n",
    "df = df - 1\n",
    "write_feather(df, \"dm6-5kb-upstream-full-tx-11species.mc8nr.feather\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.6.4 (pyscenic_dev)",
   "language": "python",
   "name": "pyscenic_dev"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
